package com.justnow.offer;

import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-16
 * Description
 */
public class Dianxin01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int uglyNumber = getUglyNumber(n);
        System.out.println(uglyNumber);
    }

    public static int getUglyNumber(int n) {
        int[] dp = new int[n];
        int i2 = 0, i3 = 0, i5 = 0;
        dp[0] = 1;
        for (int i = 1; i < n; i++) {
            int min = Math.min(dp[i2] * 2, Math.min(dp[i3] * 3, dp[i5] * 5));
            dp[i] = min;
            if (min == dp[i2] * 2)
                i2++;
            if (min == dp[i3] * 3)
                i3++;
            if (min == dp[i5] * 5)
                i5++;
        }
        return dp[n - 1];
    }
}
